package cn.intellijboy.gradle.plugin.task;

import org.gradle.api.DefaultTask;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.Optional;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.options.Option;

/**
 * 依赖下载任务
 * 下载指定依赖或指定下载某个配置对象下的依赖、支持指定依赖输出内容格式和保存位置
 * <p>
 * 任务名称：downloadDependency
 * 任务分组：xingzhe
 * 任务入参：--configuration=[compileClasspath, runtimeClasspath] --gav=[groupId:artifactId:version]
 * 输出参数：--output=[console,file location]
 * <p>
 * 任务依赖：downloadDependency --> analyzeDependency
 */
public class DownloadDependencyTask extends DefaultTask {

    private String configuration;
    private String gav;
    private String output = "console";

    @Input
    @Optional
    @Option(option = "configuration", description = "指定要下载依赖的配置名称，多个用逗号分隔，如：compileClasspath,runtimeClasspath")
    public String getConfiguration() {
        return configuration;
    }

    public void setConfiguration(String configuration) {
        this.configuration = configuration;
    }

    @Input
    @Optional
    @Option(option = "gav", description = "指定要下载的依赖 GAV 坐标，格式：groupId:artifactId:version")
    public String getGav() {
        return gav;
    }

    public void setGav(String gav) {
        this.gav = gav;
    }

    @Input
    @Optional
    @Option(option = "output", description = "输出方式：console（控制台）或文件路径")
    public String getOutput() {
        return output;
    }

    public void setOutput(String output) {
        this.output = output;
    }

    @TaskAction
    public void download() {

    }

}

